//
//  WKHTTPSessionManager.h
//  ourToken
//
//  Created by wakeup on 2018/6/14.
//  Copyright © 2018年 ourtoken. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "WKBaseHeader.h"

#define httpManager WKHTTPSessionManager

typedef void (^successBlock) (NSDictionary *result);
typedef void (^errorBlock) (NSError *error);

@interface WKHTTPSessionManager : NSObject

/**
 登录
 @param phoneNum 电话号码
 @param password 密码
*/
+ (void)loginWithPhoneNum:(NSString *)phoneNum password:(NSString *)password success:(successBlock)success failure:(errorBlock)failure;

/**
 注册
 @param phoneNum 电话号码
 @param code 验证码
 @param password 密码
 */
+ (void)registerWithPhoneNum:(NSString *)phoneNum code:(NSString *)code password:(NSString *)password success:(successBlock)success failure:(errorBlock)failure;

/**
 验证码
 @param phoneNum 电话号码
 */
+ (void)getCodeWithPhoneNum:(NSString *)phoneNum success:(successBlock)success failure:(errorBlock)failure;

/**
 绑定设备
 @param identifier 电话号码
 */
+ (void)bindingDevicesWithIdentifier:(NSString *)identifier success:(successBlock)success failure:(errorBlock)failure;

/**
 钱包列表
 @param pageIndex 页数
 @param pageSize 每页的数量
 */
+ (void)getWalletListWithPageIndex:(int)pageIndex pageSize:(int)pageSize success:(successBlock)success failure:(errorBlock)failure;

//获取钱包序列号(创建钱包前需要获取)
+ (void)getWalletSerialNumberSuccess:(successBlock)success failure:(errorBlock)failure;

/**
 创建钱包
 @param coinType 币种(ETH或BTC等)
 @param name 钱包名称
 @param address 钱包地址
 @param serialNumber 钱包序列号（类似id唯一标识）
 @param createType 创建方式（1：创建；2：助记词导入；3：keystore导入；4：明文私钥导入）
 @param encryptedStr 助记词（加密后的）
 */
+ (void)foundWalletWithCoinType:(NSString *)coinType name:(NSString *)name address:(NSString *)address serialNumber:(NSString *)serialNumber createType:(int)createType encryptedStr:(NSString *)encryptedStr success:(successBlock)success failure:(errorBlock)failure;

/**
 删除钱包
 @param walletId 钱包id
 */
+ (void)deleteWalletWithWalletId:(NSInteger)walletId success:(successBlock)success failure:(errorBlock)failure;

/**
 钱包交易列表
 @param walletId 钱包id
 @param coinType 币种(ETH或BTC等)
 @param pageIndex 页数
 @param pageSize 每页的数量
 */
+ (void)getWalletTransactionListWithWalletId:(NSInteger)walletId coinType:(NSString *)coinType pageIndex:(int)pageIndex pageSize:(int)pageSize success:(successBlock)success failure:(errorBlock)failure;

/**
 地址列表
 @param pageIndex 页数
 @param pageSize 每页的数量
 */
+ (void)getAddressListWithPageIndex:(int)pageIndex pageSize:(int)pageSize success:(successBlock)success failure:(errorBlock)failure;

/**
 添加地址
 @param coinType 币种(ETH或BTC等)
 @param name 钱包名称
 @param address 钱包地址
 */
+ (void)addAddressWithCoinType:(NSString *)coinType name:(NSString *)name address:(NSString *)address success:(successBlock)success failure:(errorBlock)failure;

/**
 修改地址
 @param addressId 地址id
 @param coinType 币种(ETH或BTC等)
 @param name 钱包名称
 @param address 钱包地址
 */
+ (void)updateAddressWithAddressId:(NSInteger)addressId coinType:(NSString *)coinType name:(NSString *)name address:(NSString *)address success:(successBlock)success failure:(errorBlock)failure;

/**
 删除地址
 @param addressId 地址id
 */
+ (void)deleteAddressWithAddressId:(NSInteger)addressId success:(successBlock)success failure:(errorBlock)failure;

/**
 修改用户语言
 @param languageType 语言类型
 */
+ (void)setLanguageType:(NSString *)languageType success:(successBlock)success failure:(errorBlock)failure;

/**
 修改用户货币类型
 @param currencyType 货币类型
 */
+ (void)setCurrencyType:(NSString *)currencyType success:(successBlock)success failure:(errorBlock)failure;

//获取以太币交易费区间
+ (void)getEthFeesRangeSuccess:(successBlock)success failure:(errorBlock)failure;

/**
 构建交易
 @param walletId 钱包id
 @param toAddress 接收方地址
 @param amount 交易金额
 @param fee 旷工费用
 */
+ (void)buildTransactionWithWalletId:(NSInteger)walletId toAddress:(NSString *)toAddress amount:(NSString *)amount fee:(NSString *)fee success:(successBlock)success failure:(errorBlock)failure;

/**
 新增比特币/以太坊交易(先构建再新增)
 @param coinType 币种(ETH或BTC等)
 @param walletId 钱包id
 @param toAddress 接收方地址
 @param remark 交易备注
 @param txHex 交易Hex
 */
+ (void)addTransactionWithCoinType:(NSString *)coinType walletId:(NSInteger)walletId toAddress:(NSString *)toAddress remark:(NSString *)remark txHex:(NSString *)txHex success:(successBlock)success failure:(errorBlock)failure;

/**
 交易列表
 @param pageIndex 页数
 @param pageSize 每页的数量
 */
+ (void)getTransactionListWithPageIndex:(int)pageIndex pageSize:(int)pageSize success:(successBlock)success failure:(errorBlock)failure;

/**
 获取交易详情
 @param coinType 币种(ETH或BTC等)
 @param txId 待定
 */
+ (void)getTransactionDetailsWithCoinType:(NSString *)coinType txId:(NSString *)txId success:(successBlock)success failure:(errorBlock)failure;


@end
